﻿/* 3. Write a program that safely compares floating-point numbers with precision of 0.000001. 
 * Examples:(5.3 ; 6.01) --> false;  (5.00000001 ; 5.00000003) --> true. */

using System;

public class CompareNumbersWithPrecision
{
    public static void Main()
    {
        double firstNumber;
        double secondNumber;
        double difference;

        do
        {
            Console.Clear();
            Console.Write("First number = ");
            if (double.TryParse(Console.ReadLine(), out firstNumber))
                break;
        } while (true);

        do
        {
            Console.Clear();
            Console.Write("First number = {0}\nSecond number = ", firstNumber);
            if (double.TryParse(Console.ReadLine(), out secondNumber))
                break;
        } while (true);

        difference = secondNumber - firstNumber;
        if (difference < 0)
            difference *= -1;

        if (difference <= 0.000001)
            Console.WriteLine("true");
        else
            Console.WriteLine("false");
    }
}